<template>
  <div class="app-container">
    <div class="top">
      <el-select style="margin-left: 10px;" v-model="value2" placeholder="请选择玩法" size="small" @change='selectTwo'>
        <el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value">
        </el-option>
      </el-select>
    </div>

    <el-table :data="tableData" border style="width: 80%;">
      <el-table-column label="玩法" width="150" align="center">
        <template slot-scope="scope">{{scope.row.type==1?'排列5':scope.row.type==2?'排列3':scope.row.type==3?'福彩3d':'大乐透'}}</template>
      </el-table-column>
      <el-table-column label="期数" width="150" align="center">
        <template slot-scope="scope">{{scope.row.period}}</template>
      </el-table-column>
      <el-table-column label="中奖号码" width="200" align="center">
        <template slot-scope="scope">{{scope.row.winNumber}}</template>
      </el-table-column>
      <el-table-column label="日期" width="auto" align="center">
        <template slot-scope="scope">{{scope.row.periodDate}}</template>
      </el-table-column>
    </el-table>

    <el-pagination background layout="prev, pager, next" :total="total" @current-change="indexChange" style="margin-top: 30px;margin-left: 50%;">
    </el-pagination>
  </div>
</template>

<script>
  import { listPeriod } from '@/api/newTc'
  export default {
    name: 'orderDetail',
    data() {
      return {
        pageNum:1,
        pageSize:10,
        total: 0,
         options2: [{
           value: '1',
           label: '排列5'
         }, {
           value: '2',
           label: '排列3'
         }, {
           value: '3',
           label: '福彩3D'
         }, {
           value: '4',
           label: '大乐透'
         }],
        value2:'',
        //订单列表
        tableData:[]
      }
    },
    created() {
      this.init()
    },
    methods: {
      //玩法选择
      selectTwo(e){
        console.log(e)
        this.type = e
        this.pageNum = 1
        this.init()
      },
      //分页
      indexChange(e){
        console.log(e)
        this.pageNum = e
        this.init()
      },
      //初始化
      init(){
        this.listPeriod()
      },
      listPeriod(){
        let data = {
          type:this.type,
          pageNum:this.pageNum,
          pageSize:this.pageSize,
        }
        listPeriod(data).then(res=>{
          console.log(res)
          this.tableData = res.data.list
          this.total = res.data.total
        })
      },
    }
  }
</script>

<style scoped>
  .app-container {
    margin-top: 40px;
    margin-left: 120px;
    margin-right: 120px;
    min-height: 500px;
  }
  .top {
    display: flex;
    align-items: center;
    margin-bottom: 50px;
  }

  .topSearch {
    width: 300px;
    display: flex;
    align-items: center;
  }

</style>
